Skip to content

109 docs validate readme template structure in elastic package #2716

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

haetamoudi
Copy link
Contributor

@haetamoudi haetamoudi commented Jul 8, 2025

Changes in package-specs that need to occur before elastic/package-spec#924
Tests will fail until then.

Initial discussion on elastic-package
RFC

Goal

Enforce the structure of the docs (README.md) according to the template created by the docs team.

Implementation

The template will be enforced only on new integrations. When not set in validation.yml the docs_structure_enforced is false by default.
The template will evolve with time, so we need to be able to handle versions.

cmd/build.go Outdated
err = docs.ValidateDocsStructure(packageRoot)
if err != nil {
return fmt.Errorf("validating docs structure failed: %w", err)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we do this after updating readmes below?


func validateReadmeStructure(packageRoot string) (error) {
requiredHeaders := []string{"Overview", "Troubleshooting", "Scaling"}
fileName := "README.md"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are packages with a main README.md, and multiple .md files, one for each policy template. An example of this is the AWS package. Do we want to apply the same validation in these cases?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know where those other .md files are used? And if they have the same type of content than the readme.md? If so, I think they should be validated too yes.
If was also wondering if we should validate the docs under _dev/build/docs or under build/docs instead as not all integrations have a _dev/build/docs/README. wdyt?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know where those other .md files are used?

The are used in packages that define multiple policy templates. They are used in the integrations UI, where each template appears as a different tile, as if it were a different package.

See for example the AWS package: https://github.com/elastic/integrations/tree/main/packages/aws/docs

And if they have the same type of content than the readme.md? If so, I think they should be validated too yes.

In principle they have the same type of content, yes.

If was also wondering if we should validate the docs under _dev/build/docs or under build/docs instead as not all integrations have a _dev/build/docs/README. wdyt?

We should validate the docs under the docs directory, that will be the files included in the package.

_dev/build/docs may contain templating and in principle doesn't need to be valid as final documentation.

dependencies:
ecs:
reference: [email protected]
docs_structure_enforced: true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can make this an object, so it doesn't need to be an all or nothing? This could allow for example to introduce some additional setting to force only a set of headers.

  docs_structure_enforced:
    enabled: true
    skip:
      - title: Performance and scaling
        reason: System metrics, no performance tuning available.

dependencies:
ecs:
reference: [email protected]
docs_structure_enforced: true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This setting should not be under dependencies.

It could also belong to the validation.yml file at the root of the package.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it might make more sense indeed to have it as part of the validation.yml instead

@elasticmachine
Copy link
Collaborator

elasticmachine commented Jul 16, 2025

💔 Build Failed

Failed CI Steps

History

@haetamoudi haetamoudi marked this pull request as ready for review July 16, 2025 09:13
@haetamoudi haetamoudi requested a review from a team as a code owner July 16, 2025 09:13
@haetamoudi haetamoudi requested review from kgeller and mjwolf July 16, 2025 09:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants